package com.xbongbong.saas.enums.dictionary;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @author jiyonghui
 * @className CouponTempleteStatusEnum
 * @description
 * @date 2020/1/6   14:41
 */
@Getter
public enum InapplicableProductTypeEnum {
    // 适用对象类型

    NONE("0", "enum.ForbidProductTypeEnum.name.none", "none"),
    SPECIAL_PRODUCT("1", "enum.ForbidProductTypeEnum.name.special_product", "specialProduct"),
    FIXED_PRODUCT("2", "enum.ForbidProductTypeEnum.name.fixed_product", "fixedProduct"),
    ;

    private String code;
    private String name;
    private String attr;

    InapplicableProductTypeEnum(String code, String name, String attr) {
        this.code = code;
        this.name = name;
        this.attr = attr;
    }


    public static String getByCode(String number) {
        for (InapplicableProductTypeEnum marketingActivityStatusEnum : values()) {
            if (Objects.equals(marketingActivityStatusEnum.getCode(), number)) {
                return marketingActivityStatusEnum.getName();
            }
        }
        return null;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
